<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <link rel="stylesheet" href="css/timer.css">
  <script src="https://cdn.bootcss.com/jquery/1.7.2/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
  <script src="js/timer.js"></script>
</head>
<body>

<div id="timer" class="timer" style="width: 360px;"></div>
</body>
</html>
<script>
  $(function () {
    var myTimer = new timer();
    myTimer.init({
      dom: '#timer',
      month: '2018-01',
      data: [{
        day: '1',
        price: '234'
      }, {
        day: '2',
        price: '234'
      }, {
        day: '3',
        price: '234'
      }, {
        day: '4',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }, {
        day: '5',
        price: '234'
      }],
      // 上个月
      pre: function () {
        alert('上个月回调');
        myTimer.init({
          month: '2017-12',
          data: [{
            day: '1',
            price: '11'
          }]
        })
      },
      // 下个月
      next: function () {
        alert('下个月回调');
        myTimer.init({
          month: '2018-02',
          data: [{
            day: '1',
            price: '11'
          }]
        })
      }
    });
  })
</script>